const prefix = "pc_bosideng_";
const localStore = {
  get(str) {
    if (!window.localStorage) return null
    let item = window.localStorage.getItem(prefix + str)
    try {
      return JSON.parse(item)
    } catch (error) {
      return item
    }
  },
  set(str, data) {
    if (!window.localStorage) return null
    if (typeof data !== 'object') {
      window.localStorage.setItem(prefix + str, data)
    } else {
      window.localStorage.setItem(prefix + str, JSON.stringify(data))
    }
  },
  del(str) {
    if (!window.localStorage) return null
    window.localStorage.removeItem(prefix + str)
  }

}
export default localStore;
